
tags = {
    name: "order",
    description: "订单管理模块",
};

schemas = {
    order: {
        // 用来描述用户的属性
        properties: {
            _id: {
                type: "string",
                description: "用户唯一标识",
            },
            movieImg: {
                type: "string",
                description: "订单图片",
            },
            moveName: {
                type: "string",
                description: "电影名字",
            },
            cinemaName: {
                type: "string",
                description: "影院名字",
            },
            theater: {
                type: "string",
                description: "放映厅",
            },
            displayName: {
                type: "string",
                description: "座位号",
            },
            showDate: {
                type: "string",
                description: "订单日期",
            },
            showTime: {
                type: "string",
                description: "订单时间",
            },
            price: {
                type: "string",
                description: "价格",
            },
            nowdateTime: {
                type: "string",
                description: "当前时间",
            },
            username: {
                type: "string",
                description: "用户名",
            },
        },
    },
};

paths = {
    "/order/orderList": {
        get: {
            tags: ["order"],
            summary: "订单列表",
            description: "渲染订单列表",
            // 请求的数据类型 json
            consumes: ["application/json"],
            // 请求参数
            parameters: [
                {
                    name: "curPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "当前页码",
                },
                {
                    name: "eachPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "每页条数",
                },
            ],
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/order",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
    "/order/addorder": {
        post: {
            tags: ["order"],
            summary: "新增订单接口",
            description: "新增订单信息",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/order",
                        },
                        example: {
                            moveName: "悬崖之上",
                            cinemaName: "万达影院",
                            theater: "三号厅",
                            seatingId: "60541a3f25e17b406161b1d0",
                            displayName: "2排2号",
                            showDate: "2021-8-2",
                            showTime: "20:00",
                            price: "34",
                            nowdateTime: "2021-07-04 14:53:12",
                            username:"zhangsan"
                        },
                    },
                },
            },
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/order",
                            },
                            example: {
                                moveName: "悬崖之上",
                                cinemaName: "万达影院",
                                theater: "三号厅",
                                seatingId: "60541a3f25e17b406161b1d0",
                                displayName: "2排2号",
                                showDate: "2021-8-2",
                                showTime: "20:00",
                                price: "34",
                                nowdateTime: "2021-07-04 14:53:12",
                                username:"zhangsan"
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
};

module.exports = { tags, schemas, paths };